package com.xbao.controller;

import com.xbao.core.http.CommRequest;
import com.xbao.core.http.CommResult;
import com.xbao.model.NotifySetting;
import com.xbao.model.req.NotifysettingReq;
import com.xbao.service.NotifysettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by qingshengzheng on 2019/1/20.
 */
@Api(value = "/notifysetting", tags = "notifysetting")
@RequestMapping(value = "notifysetting")
@Controller
@EnableAutoConfiguration
public class NotifysettingController extends BaseController {
    @Resource
    private NotifysettingService notifysettingService;

    @ApiOperation(value = "updateSetting", notes = "updateSetting")
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    @ResponseBody
    public Object updateSetting(@RequestBody CommRequest<NotifysettingReq> notifysettingReqCommRequest) {
        notifysettingService.updateSettings(notifysettingReqCommRequest.getData());
        return result();
    }
    @ApiOperation(value = "detail", notes = "detail")
    @RequestMapping(value = "/detail", method = RequestMethod.POST)
    @ResponseBody
    public Object detailSetting(@RequestBody CommRequest<NotifysettingReq> notifysettingReqCommRequest) {
        NotifySetting notifySetting =notifysettingService.detail(notifysettingReqCommRequest.getData());
        return new CommResult<>(notifySetting);
    }
}
